package com.sice;

public enum TestEnum {
    RED,WHITE,BLACK;    //枚举对象

    public static void main(String[] args) {
        TestEnum[]testEnums=TestEnum.values();
//        System.out.println(testEnums);
//        for (int i = 0; i <testEnums.length ; i++) {
////            System.out.println(testEnums[i]);
//            System.out.println(testEnums[i].ordinal());
//        }
        TestEnum testEnum=TestEnum.valueOf("BLACK");
        System.out.println(testEnum);

    }

    public static void main1(String[] args) {
        TestEnum testEnum=RED;
        switch (testEnum){
            case RED:
                System.out.println("RED");
                break;
            case WHITE:
                System.out.println("WHITE");
                break;
            case BLACK:
                System.out.println("BLACK");
                break;
            default:
                System.out.println("无法匹配");
                break;
        }
    }
}
